using System;
using System.Collections.Generic;
using System.Text;
using System.Runtime.InteropServices;

namespace SystemFunctionLib.Apis
{
    internal class CoreApis
    {
        public static uint SizeOf(Type type)
        {
            return (uint)Marshal.SizeOf(type);
        }

        public static uint SizeOf(object structure)
        {
            return (uint)Marshal.SizeOf(structure);
        }

        public unsafe static IntPtr GetIntPtr(int value)
        {
            void* pt = (void*)&value;
            return new IntPtr(pt);
        }

        public unsafe static IntPtr GetIntPtr(long value)
        {
            void* pt = (void*)&value;
            return new IntPtr(pt);
        }

        public unsafe static IntPtr GetIntPtr(uint value)
        {
            void* pt = (void*)&value;
            return new IntPtr(pt);
        }

        public unsafe static IntPtr GetIntPtr(bool value)
        {
            void* pt = (void*)&value;
            return new IntPtr(pt);
        }

        public static Exception GetWinLastError()
        {
            return new InvalidOperationException();
        }

    }
}
